package com.itfreer.gis.graphic;

public class GisPoint extends GisGraphic{
	/**
	 * x坐标或者l
	 */
	private double x;
	/**
	 * y坐标或者b
	 */
	private double y;
	/**
	 * z坐标或者h
	 */
	private double z;
	
	public double getX() {
		return x;
	}
	public void setX(double x) {
		this.x = x;
	}
	public double getY() {
		return y;
	}
	public void setY(double y) {
		this.y = y;
	}
	public double getZ() {
		return z;
	}
	public void setZ(double z) {
		this.z = z;
	}
	
	/**
	 * 重构equals函数
	 */
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof GisPoint) {
			double accuracy=0.000000001;
			GisPoint tp=(GisPoint) obj;
			if(Math.abs(this.x-tp.x)<accuracy
					&& Math.abs(this.y-tp.y)<accuracy
					&& Math.abs(this.z-tp.z)<accuracy) {
				return true;
			}else {
				return false;
			}
		}else {
			return false;
		}
	}
	
	public GisPoint() {
		this.graphicType=GraphicType.POINT;
	}
	@Override
	public void setGeometry() {
		this.geometry="POINT("+this.getX()+" "+this.getY()+")";
		
	}
}
